Skip to content

feat(plugin-form): an undeclared form dialog spreads a field-heavy form to three columns, four in a full dialog - #34645

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-34607-dialog-width-columns
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-34607-dialog-width-columns

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread
Fixes #34607
Clause-②: no
Metadata-protocol: none

repo:objectstack#3 · os-support-ai · session_01WGufzgwLiKcfujYUug7sPs

维护者速读

  • 改了什么:表单弹窗在作者没写 columns 时,不再固定 2 列:字段多(9 个以上)的表单在标准弹窗里排 3 列,在 full 弹窗里(16 个以上字段)排 4 列;窄屏仍 1 列。分组、对象字段分组同样处理。
  • 为什么改:维护者原话「目前默认只有两列字段,对于复杂的业务表单,宽屏时候非常浪费」。xl 弹窗的字段区实测宽 61rem,已过 4 列断点(56rem),所以标准弹窗封顶 3 列、放大(full)才到 4 列,正好对上验收「xl 弹窗 3 列,放大后 4 列」。
  • 风险与回滚:只动弹窗;整页、向导、分页签表单输出不变(有对照测试)。作者显式写了 columns(含 1)的照写。回滚即 revert 本 PR。HotCRM 很多表单显式写了 columns: 2,所以在去掉这些声明之前 HotCRM 看不到变化(本 PR 不碰 hotcrm)。附件(file / image)在本 PR 里仍占一格:改成独占整行要动共享的 WIDE_FIELD_TYPES,会连带改变整页、抽屉和详情布局,与「不改整页表单的现有推断」冲突,席位已把这个问题提交维护者。
  • 先看:ui/packages/plugin-form/src/autoLayout.ts 的 dialogUndeclaredColumns(封顶规则);ui/packages/plugin-form/src/ModalForm.tsx 的 effectiveModalSize / undeclaredColumns 两段(尺寸先算、列数后算,不循环);__tests__/dialogContainerColumns-34607.test.tsx。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/plugin-form/src/__tests__/dialogContainerColumns-34607.test.tsx,预期 14 个用例全部通过。
  • 需要你做的:无,席位落地。

What changes

A form dialog whose author declared no columns drew every form two per row. It now takes its count from dialogUndeclaredColumns(fieldCount, modalSize) (new, dialog-only, in autoLayout.ts):

  • inferColumns of the fields the dialog lays out, at least 2 (the old fixed default, so a form of up to eight fields draws exactly what it drew before);
  • at most 3 in a bounded dialog, 4 only in a full one. Measured, not assumed: the xl dialog is sm:max-w-5xl (64rem) and its @container scroller pads sm:px-6, so the field container is 61rem wide, over the @4xl tier (56rem). A literal containerGridColsFor(4) would therefore draw four columns in xl, against acceptance 1 (「xl 弹窗里是 3 列」). The size cap is what makes the acceptance true.

The count reaches all three dialog arms: the flat form (fed to applyAutoLayout through the explicit-columns route), the object's fieldGroups fallback (derived groups no longer stamp a fixed columns; the arm reads the form's declared count, else the dialog's), and authored sections (sectionedGridLayout takes a new optional third argument, undeclared).

Dialog-only, per the claim's corrected premise: UNDECLARED_SECTION_COLUMNS, and the defaults of sectionColumnsFor, sectionedFormColumns and sectionedGridLayout, are unchanged. The three functions gained an optional trailing undeclared parameter defaulting to that constant; ObjectForm, TabbedForm and WizardForm do not pass it. None of the touched symbols is in the package's published entries (index.tsx, core.ts), so the public surface is byte-unchanged.

Card items:

  1. Undeclared dialog grid follows the container tiers: done, with the size cap above.
  2. Size inference allows xl for field-heavy forms: already true on main, and unchanged. The size reads the declared grid or the floor of 2, never the count it then bounds, so there is no cycle. Proof: an undeclared grid is at least 2 either way, so inferModalSize(min(grid, inferColumns(n))) gives the same answer as before for every input.
  3. Wide kinds at 4 columns: textarea, rich text, markdown, html and inline grid take the whole row at every tier (pinned at 4 columns). Attachments (file / image) stay one cell in this PR. They are not in the shared WIDE_FIELD_TYPES, and adding them there would also change page, drawer and detail layouts, which conflicts with 「不改整页表单的现有推断」. No code changes for them here. The seat is taking that question to the maintainer (claim amendment 6938698182).
  4. A declared columns is drawn as written: pinned for 2 and 1, on the form and on a section.

Maximize / full-page toggle is #34604. Acceptance 1's 「放大后是 4 列」 is shown under the existing authored modalSize: 'full'.

Before / after (sixteen undeclared fields, fields per row at @md / @2xl / @4xl; below @md always 1)

Surface main (97defd6) this PR
dialog, inferred xl 2 / 2 / 2 2 / 3 / 3
dialog, modalSize: 'full' 2 / 2 / 2 2 / 3 / 4
dialog, declared columns: 2 2 / 2 / 2 2 / 2 / 2
dialog, five fields 2 / 2 / 2 2 / 2 / 2
ObjectForm sectioned page, undeclared 2 / 2 / 2 2 / 2 / 2

Tests

  • New __tests__/dialogContainerColumns-34607.test.tsx (14 cases) covers acceptance 1 (xl, full, phone, wide kinds at 4), acceptance 2 (declared 2 and 1, a declared section beside an undeclared one), undeclared sections and fieldGroups, the light-form floor, and the page controls: ObjectForm sectioned and flat, plus sectionedGridLayout with no third argument.
  • Pins moved, with reason (acceptance 3):
    • dialogDefaultLayout-12521.test.tsx: its twelve-field fixture (inferColumns gives 3) now draws the three-wide grid. Four expectations moved from the 2-wide grid and @md:col-span-2 to the 3-wide grid and ['@md:col-span-2', '@2xl:col-span-3']. The phone-column check now reads "every multi-column tier is a container query" in place of "every tier is @md". Size, authored-layout and light-form pins are unchanged.
    • undeclaredSectionDensity-12592.test.tsx: in the page-host case "every section undeclared", the byte-equality with the dialog is replaced. The page still reads 2 / 2 / 2 (unchanged), and the dialog reference now reads 2 / 3 / 3. The light MIXED case still matches the dialog byte for byte.
    • mixedSectionColumns-12548, sectionColumns.test.tsx, modalFieldGroups.test.tsx, autoLayout.test.ts, modalViewportGutter-12593, and app-shell AppContent.recordDialogInterimBound-12521 / AppContent.formViewModalSize-12803 needed no change; all of them pass as they are.
Readings
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/: Test Files 234 passed (234) · Tests 2607 passed | 1 skipped (2608) · lock VERDICT command-exit 0
  • app-shell pins (AppContent.recordDialogInterimBound-12521, AppContent.formViewModalSize-12803): Test Files 2 passed (2) · Tests 21 passed (21)
  • pnpm --filter @object-ui/plugin-form type-check (tsc --noEmit && tsc -p tsconfig.test.json): VERDICT command-exit 0
  • Ablation, once, via scripts/ablation-replace.mjs on committed HEAD: anchor const cap = modalSize === 'full' ? 4 : 3; replaced by const cap = 4; (anchor 1 to 0, blob 6c11ba904537 to 0512e09117ac). Then dialogContainerColumns-34607: Tests 5 failed | 9 passed (14) (xl three-wide, declared-section beside undeclared, undeclared sections, fieldGroups, helper). Restored: blob equals HEAD, git diff HEAD empty. The test file imports ../ModalForm / ../autoLayout from source, so no dist leg applies.
Fix round 1 readings (head 7ec78e2, README only)
  • dispatch-gates --commands --repo objectstack-ai/objectstack ui/packages/plugin-form/README.md: 19 families, every one exit 0. --ran reconciliation: 19 derived famil(ies) accounted for — 19 run, 0 NOT-MEASURED (a DERIVED zero …).
  • ui pnpm check:new-line-citations: 0 new citation(s), exit 0.
  • overlap-check before the push: VERDICT clean exit 0 (origin/main 518baca, and feat(plugin-form): section navigation for stacked sectioned forms #34642 shares ModalForm.tsx; both merge cleanly).
  • No code changed this round, so the round-0 test readings stand.

Acceptance notes

  • Card item 3, attachments: file / image stay one cell in this PR, in the dialog and on the page alike. Making them wide in the shared WIDE_FIELD_TYPES would change page, drawer and detail layouts, which conflicts with 「不改整页表单的现有推断」. The seat is taking that question to the maintainer.
  • ui/packages/plugin-form/README.md § "Column width of a sectioned form" was stale: it said an undeclared sectioned form "is single-column". It now names the page hosts' default (2 per row) and the dialog's own undeclared count (2 to 3 by field count, 4 in a full dialog). It also says that a declared columns is drawn as written. The file was added to the surface by claim amendment 6938698182; this was fix round 1.
  • HotCRM declares columns: 2 on many forms, so HotCRM shows no change until those declarations go. hotcrm is not touched.

Verification

Local gates follow the dispatch-gates --commands list derived for this diff; readings are in the report comment. Browser check: NOT MEASURED (jsdom evaluates no container query). The tier claim rests on the class reading in the tests plus the 64rem − 3rem = 61rem ≥ 56rem arithmetic above.


Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs

… three wide when bounded, four in a full dialog

Claude-Session: https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs
Co-authored-by: Claude <noreply@anthropic.com>
…21/12592 dialog pins to it

Claude-Session: https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 17, 2026
…efault and the dialog's undeclared count

Claude-Session: https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgwLiKcfujYUug7sPs

Final green head for L1 · 2026-11-17T05:20Z
Head-sha: 7ec78e2747fecaf0f64367e3249b0cdd3aa757d3

  • Check-runs on this head: 41 success, 15 skipped, 0 failure / in progress; mergeable_state: clean.
  • The earlier Test UI red on 53e728b was run 44019396946, conclusion: cancelled (ci.yml concurrency cancel on the fix-round push), not a test failure.
  • Fix round 1 (seat claim amendment 6938698182): README "Column width of a sectioned form" corrected; body declares attachments (file/image) stay one cell, maintainer question held by the seat on 表单弹窗:作者没写列数时按容器宽度排到 3–4 列,弹窗尺寸随之放大 #34607.
  • Sent to L1-a (area o3-B); not ready, not queued.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhshTXCAmv9KJXRZkB

席位核对 · L1 (seat 3, L1-a) · 2026-11-17T05:22Z

L1: ACCEPT
Head-sha: 7ec78e2
Card: #34607 (triage 6937264999, ruling 6939109581) · claim 6937557686 · amendment 6938698182 · os-dev-reports 6938668275 (round 0), 6938947342 (round 1)

Must-fix

None.

Should-fix

None.

Readings that hold

Item Reading
PR shape Draft, base main, Fixes #34607, kept by the seat's ruling 6939109581 (the attachments half of item 3 goes to a follow-up card). No !, no (narrowing): no dogfood battery owed. mergeable_state clean.
Scope 7 files, all inside claim 6937557686 plus amendment 6938698182: ModalForm.tsx (column and size hunks plus the sectioned call), autoLayout.ts (a new dialog-only helper and an optional trailing parameter), three tests under src/__tests__/, README.md (the amended section) and the changeset. The app-shell pin named "only if its pin moves" did not move and is untouched.
Shared defaults untouched sectionColumnsFor, sectionedFormColumns and sectionedGridLayout gain undeclared: number = UNDECLARED_SECTION_COLUMNS as a trailing parameter. Every page host (ObjectForm, TabbedForm, WizardForm) calls them without it, so their output is byte-for-byte what it was; UNDECLARED_SECTION_COLUMNS, inferColumns, CONTAINER_GRID_COLS and WIDE_FIELD_TYPES are unchanged. This matches the card's 「不改整页表单的现有推断」 and the claim's "shared defaults untouched".
Clause-② / Metadata-protocol no / none in body, changeset and claim. @object-ui/plugin-form is published, with two entries: . (src/index.tsx) and ./core (src/core.ts). Neither re-exports dialogUndeclaredColumns, sectionColumnsFor, sectionedFormColumns or sectionedGridLayout; the autoLayout names they do export (inferColumns, inferModalSize, containerGridColsFor, …) keep their signatures. No spec or schema key: FormSectionSchema.columns already leaves an undeclared count to the renderer (view.mdx reference: "Undeclared: the renderer's choice by available width"), so no L2 is owed.
The rule, read against the code dialogUndeclaredColumns(n, size) = min(max(2, inferColumns(n)), size === 'full' ? 4 : 3). With inferColumns at ≤3→1, ≤8→2, ≤15→3, else 4, that gives 2 up to eight fields, 3 from nine, and 4 from sixteen only in full, as the changeset and README say.
The cap, by arithmetic xl is sm:max-w-5xl (64rem); less the scroller's sm:px-6 the field container is about 61rem, over @4xl (56rem) and @2xl (42rem). A four-wide class there would draw four columns, so a literal containerGridColsFor(4) would break acceptance 1; the size-tied cap is the right reading of the card. full is reached only when authored (inferModalSize returns lg/xl).
No size/count cycle effectiveModalSize reads the declared grid or the floor of 2 (DIALOG_DEFAULT_COLUMNS) and the field count, never undeclaredColumns, which is computed after it from the size. Inferred sizes are unchanged from main for every input.
The three arms Flat: flatColumns = schema.columns ?? undeclaredColumns into applyAutoLayout. Authored sections: sectionedGridLayout(schema.columns, …, undeclaredColumns). Field groups: the derived sections no longer carry a stamped columns, and the arm reads clampColumns(schema.columns) ?? undeclaredColumns; the size path sees the same undeclared sections as before, so its reading is unchanged. A declared columns, 1 included, wins on every arm (ruling 6204264665 kept).
Existing-test edits dialogDefaultLayout-12521: four expectations move from the 2-wide to the 3-wide grid because its twelve-field fixture now infers three; the size (sm:max-w-5xl), one-cell-per-field and wide-row pins stay. The @md:-prefix check widens to @ because the three-wide grid adds an @2xl: tier; it still asserts every multi-column tier is a container query over a one-column base. undeclaredSectionDensity-12592: the page-equals-dialog byte check is replaced, for the field-heavy fixture only, by explicit ladders (page [2,2,2], dialog [2,3,3]); the light fixture still matches byte for byte. Each edit follows from the card's change; none drops a check without a replacement.
Docs The README section "Column width of a sectioned form" now gives both counts and drops the stale "without either it is single-column" (the page default has been 2 since objectui#12592). content/docs and skills have no sentence about the dialog's default column count; the columns reference text stays true.
Changeset Names @object-ui/plugin-form, the one package whose src moved. Every sentence matches the readings above, including "the dialog's inferred size (lg or xl) is unchanged" and "full-page, tabbed and wizard forms are unchanged".
Acceptance 1 (three in a bounded dialog, four in full), 2 (declared columns: 2 stays 2), 4 (phone one column, below @md) and the long-text / sub-table half of 3 (wide kinds take the row at four) are pinned in dialogContainerColumns-34607 (14 tests). The attachments half of 3 is ruled out of this card (6939109581).
Tests Real commands with output: plugin-form 234 files / 2607 passed on the round-0 code (round 1 changed only the README and body); type-check exit 0; the two app-shell size pins 21/21 unchanged. One ablation (cap = 4) turns 5 of the 14 new pins red and was restored to the HEAD blob. 38 + 19 derived gates, all exit 0.
Tier check-governed-merges --pr 34645: NOT governed, 540 lines (+463/−77). Tier S, lands through o3-B.
CI on this head 56 check-runs: all success or skipped. Test UI (aggregate plus every planned shard), Type Check UI, Lint UI, Build & E2E UI, Live E2E UI, Test Core, Check Changeset, PR-body guards, Lint & Repo Gates and TypeScript Type Check are all success. The round-0 Test UI red was a concurrency cancel when this head was pushed (report 6938947342); this head's own run is green.

Notes

  1. Not measured in a browser. jsdom evaluates no container query, so the tier claim rests on the class reading and the rem arithmetic above, which I checked. If the landing area boots the console, a glance at a 9+ field create dialog at 1280px (three per row) is the cheapest confirmation.
  2. An authored lg dialog with nine or more fields gets the three-wide class, but its field container (42rem less the padding) is under @2xl, so it draws two. That is what the changeset says ("columns still follow the dialog's real width"); it is not a defect.
  3. Follow-up card from ruling 6939109581: multi-file file/image fields take the full row in the form auto-layout, mirroring plugin-detail's MULTI_FILE_FIELD_TYPES. The seat files it.
  4. Serial: ModalForm.tsx is shared with 带内嵌子表的表单弹窗:取消 / 保存不固定在底部,长表单要滚到最下面才看得到 #34599 and feat(plugin-form): section navigation for stacked sectioned forms #34642 (disjoint hunks, overlap-check clean), and 表单弹窗:加放大图标,原地展开为整页,与记录抽屉的放大一致 #34604 queues after this card on the same effectiveModalSize hunk. Whichever lands second merges main; a clean merge needs no new L1, a conflict in these hunks does.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgwLiKcfujYUug7sPs

Landing · area o3-B · 2026-11-17T05:58Z

Probe Reading
L1 ACCEPT 6939415200 at 7ec78e2747fecaf0f64367e3249b0cdd3aa757d3; head since moved only by a clean origin/main merge (f86cee3f33fa7698349cbf044dfb38aefdf46e59, no plugin-form hunk from main, branch delta still 7 files +463/-77), which L1-a stated needs no new read
Checks on head f86cee3f 39 success, 13 skipped, 0 failure / pending; mergeable_state: clean (after #34657 merged)
check-governed-merges.mjs --pr 34645 NOT governed; 540 changed lines ≤ 3000 (Tier S)
K (first-parent, merge-base..origin/main) 6 < 15; no merge=os-regen path in the diff

State change: ready for review + auto-merge (merge queue). Card #34607 closes on merge via Fixes; the attachments half of item 3 is card #34668 (maintainer ruling), queued in area o3-B.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 05:58
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit fecd2e9 Nov 17, 2026
53 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34607-dialog-width-columns branch November 17, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

表单弹窗:作者没写列数时按容器宽度排到 3–4 列,弹窗尺寸随之放大

2 participants